﻿using System;

namespace _026.泛型
{
	internal class Program
	{
		static void Main(string[] args)
		{
			ClassA<int> classA = new ClassA<int>(1, 2);
			Console.WriteLine(classA.GetSUm());

			// 类的tostring
			Program p = new Program();
			// 默认是命名空间.类名
			Console.WriteLine(p.ToString());
			Console.WriteLine(p);

			Student s = new Student(18, "张三");
			Console.WriteLine(s);

		}
	}
	class ClassA<T>
	{
		private T a;
		private T b;
		public ClassA(T a, T b)
		{
			this.a = a;
			this.b = b;
		}
		public T GetSUm()
		{
			// 动态类型
			dynamic num1 = a;
			dynamic num2 = b;
			dynamic result = num1 + num2;
			return (T)result;
		}
	}
}
